package com.glacier.framework.boot.rest.controller;

import com.glacier.framework.boot.rest.entity.Payload;
import com.glacier.framework.boot.rest.utils.FileUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Calendar;

/**
 * date 2023-12-30 21:02
 *
 * @author glacier
 * @version 1.0
 */
@RestController
public class IndexController {

    /**
     * 首页
     *
     * @return
     */
    @GetMapping("")
    public String index() {
        return "index";
    }

    @GetMapping("/path")
    public String path() {
        return FileUtils.getFileName();
    }

    @GetMapping("/payload")
    public Payload payload() {
        return Payload.builder()
                .date(Calendar.getInstance().getTime())
                .localDate(LocalDate.now())
                .localDateTime(LocalDateTime.now())
                .localTime(LocalTime.now())
                .build();
    }
}
